import request from '@/utils/request'

export function getMarket(params) {
  return request({
    params,
    url: '/merchant/page',
    method: 'get'
  })
}
export function getMarketType() {
  return request({
    url: '/merchantType',
    method: 'get'
  })
}

export function getMarketTemplate(params) {
  window.open('https://www.zhaoxiaoyun.cloud/merchant/excel/download');
}

export function uploadMarketTemplate(data) {
  return request({
    url: '/merchant/excel',
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data;'
    },
    transformRequest: [function (form) {
      return form;
    }],
    data
  })
}

export function addMarket(data){
  return request.request({
    url:'/merchant/admin',
    method:'post',
    data
  })
}

export function updateMarket(data){
  return request.request({
    url:'/merchant/admin',
    method:'put',
    data
  })
}
export function deleteMarket(params){
  return request.request({
    url:'/merchant/admin',
    method:'delete',
    params
  })
}